<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>


<?PHP



$con=mysqli_connect("localhost","root","","bd_news");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
	$id_update = mysqli_real_escape_string($con, $_POST['id_update']);
	$title = mysqli_real_escape_string($con, $_POST['title']);
	$description = mysqli_real_escape_string($con, $_POST['description']);
	$maintext = mysqli_real_escape_string($con, $_POST['maintext']);
	$date = mysqli_real_escape_string($con, $_POST['date']);
	

 
	

$sql="UPDATE news SET `TITLE` = '$title', `DESCRIPTION` = '$description', `MAINTEXT` = '$maintext', `DATE` = '$date' WHERE `news`.`ID_NEWS` = $id_update";

if (!mysqli_query($con,$sql)) {
  die('Error: ' . mysqli_error($con));
}
echo "Zrobiono!";



mysqli_close($con);	
echo "<meta http-equiv='refresh' content='0;url=./update_news.php'>";	
?>

</body>

</html>
